_uav = _this select 0;
_tolerance = _this select 1;

_fPush = compile loadFile "funcs\arraypush.sqf";
for [{_i = 0}, {_i < 1}, {_i = 0}] do
{
    if (!(alive _uav)) exitWith {player groupChat format["UAV %1: Connection terminated.", name _uav];};

    _vs = vehicles;
    _kvs = +[];
    _markers = +[];

    {
        if (_x != _uav) then
        {
            if ((_uav knowsAbout _x) > _tolerance && (alive _x) && ((side _uav) != (side _x))) then
            {
                [_kvs, _x] call _fPush;
            };
        };
    } forEach _vs;

    if ((count _kvs) > 1) then
    {
        if ((side player) == (side _uav)) then
        {
            {
                _m = if (format["%1", _x] in _markers) then
                {
                    format["%1", _x]
                }
                else
                {
                    _m = createMarker [format["%1", _x], position _x];
                    [_markers, _m] call _fPush;
                    _m
                };
                _m setMarkerPos (position _x);
                _c = if ((side _x) == (side _uav)) then
                {
                    "ColorBlue"
                }
                else
                {
                    _c = if ((side _x) == civilian) then
                    {
                        "ColorBlack"
                    }
                    else
                    {
                        player groupChat format ["UAV %1: Enemy contacts", name _uav];
                        "ColorRed"
                    };
                    _c
                };
                _m setMarkerColor _c;
                _m setMarkerType "Dot";
                _m setMarkerDir (direction _x);

                _s = if (("Tank" countType [_x]) > 0) then {[0.8,0.8]} else {[0.5,0.5]};

                _m setMarkerSize _s;
            } forEach _kvs;
        };
    };

    sleep 15;
    {
        deleteMarker _x;
    } forEach _markers;
};
